The dynamic linker can do a fair amount of work for each function linked, so most linkers are lazy. 动态链接器可以为每个被链接的函数做相当多的工作,所以大部分链接器都是不积极的。
Then, when the linker is setting up references to functions, it compares the TOC of the current function to the TOC of the function it's calling. 然后,当链接器设置对函数的引用时,就会将当前函数的TOC与所调用的函数的TOC进行比较。
The linker replaces that reference with the actual address at which it had loaded the function, so that the resulting binary code has the right address in place. 链接器使用加载该函数的真实地址去替换这个引用,以便生成的二进制代码在适当的位置会有正确的地址。
However, this will let the linker know additional information about the function, including which TOC it is using, so it can emit the code to swap these around if necessary. 然而,这可以让链接器知道有关函数的其他信息,包括它使用的是哪个TOC,这样如果需要,就可以产生代码来在TOC之间进行切换了。
When the program is started, the PLT contains code for each function to query the runtime linker for the address at which it has loaded a function. 当程序开始运行时,PLT包含每个函数的代码,以便查询运行期链接器,从而获得已加载某个函数的地址。